package jmm;

import org.openjdk.jol.info.ClassLayout;

import java.util.concurrent.TimeUnit;

/**
 * @ClassName jmm03
 * @date 2021/4/2 18:09
 * @Version 1.0
 * @Description //查看锁的对象的对象头信息 模拟偏向锁和无状态锁
 * @USER root
 */
public class jmm03 {
    public static void main(String[] args) throws InterruptedException {
        TimeUnit.SECONDS.sleep(5);
        Object o = new Object();
        System.out.println(ClassLayout.parseInstance(o).toPrintable());
        synchronized (o) {
            System.out.println(ClassLayout.parseInstance(o).toPrintable());
        }
    }
}
